package com.example.sxmall.service.impl;

import com.example.sxmall.dao.mapper.ReceivesMapper;
import com.example.sxmall.dao.pojo.Receives;
import com.example.sxmall.service.ReceivesService;
import com.example.sxmall.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReceivesServiceImpl implements ReceivesService {
    @Autowired
    private ReceivesMapper receivesMapper;

    @Override
    public Result listReceives() {
        List<Receives> receivesList = receivesMapper.listReceives();
        return Result.buildSuccess(receivesList);
    }

    @Override
    public Result newReceives(int limit) {
        List<Receives> newReceivesList = receivesMapper.findNewReceives(limit);
        return Result.buildSuccess(newReceivesList);
    }

    @Override
    public Result listUserReceives(int ruid) {
        List<Receives> listUserReceives = receivesMapper.findUserReceives(ruid);
        return Result.buildSuccess(listUserReceives);
    }
}
